package com.haoshuang.zhouzhoubang.ui.page.mine.info

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.ResponseBean
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class MineUserInfoViewModel : BaseViewModel() {

    /**
     * 修改门店信息
     */
    val updateTeamInfoData = StatefulMutableLiveData<ResponseBean<Any>>()
    fun updateTeamInfo(
        team_name: String,
        team_logo: String,
        team_company_pic: String,
        synopsis: String
    ) = netRequest {
        start { updateTeamInfoData.value = StateData.Loading }
        request { ApiRepo.updateTeamInfo(team_name, team_logo, team_company_pic, synopsis) }
        success { updateTeamInfoData.value = StateData.Success(it) }
        error { code, msg ->
            updateTeamInfoData.value = StateData.Error(code, msg)
        }
    }

}